package edu.practice;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

import java.util.Scanner;
public class jum {
    public static void main(String[] args) {
        Scanner se=new Scanner (System.in);
        int n1=se.nextInt();
        PersonOverride persons1[] =new PersonOverride[n1];
        for(int i=0;i<n1;i++) {
            persons1[i]=new PersonOverride();
            System.out.println(persons1[i].toString());
        }
        int n2=se.nextInt();
        ArrayList<PersonOverride> persons2=new ArrayList<PersonOverride>();
        for(int i=0;i<n2;i++) {
            PersonOverride a=new PersonOverride(se.next(),se.nextInt(),se.nextBoolean());
            if(!persons2.contains(a)) {
                persons2.add(a);
                System.out.println(a.toString());
            }
        }
        System.out.println(persons2.size());
        System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
    }
}

class PersonOverride {
    private String name;
    private int age;
    private boolean gender;
    public PersonOverride() {
        this.name = "default";
        this.age = 1;
        this.gender = true;
    }
    public PersonOverride(String name, int age, boolean gender) {
        super();
        this.name = name;
        this.age = age;
        this.gender = gender;
    }

    @Override
    public String toString() {
        return  name + "-" + age + "-" + gender;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + age;
        result = prime * result + (gender ? 1231 : 1237);
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        return result;
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        PersonOverride other = (PersonOverride) obj;
        if (age != other.age)
            return false;
        if (gender != other.gender)
            return false;
        if (name == null) {
            if (other.name != null)
                return false;
        } else if (!name.equals(other.name))
            return false;
        return true;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public boolean isGender() {
        return gender;
    }
    public void setGender(boolean gender) {
        this.gender = gender;
    }
}